package controllers

import (
	"airserver/airmodel"

	"github.com/astaxie/beego"
)

type RealController struct {
	beego.Controller
}

func (c *RealController) Get() {
	mn := c.GetString("mn")
	code := c.GetString("code")
	// datatype := c.GetString("datatype")
	// typei := c.GetString("type")
	pagenum, err := c.GetInt("pagenum")
	if nil != err {
		pagenum = 1
	} else {
		if pagenum < 1 {
			pagenum = 1
		}
	}

	num, rd, all := airmodel.GetRealData(mn, code, pagenum)
	if all%100 == 0 {
		all = all / 100
	} else {
		all = all/100 + 1
	}

	c.Data["RealMn"] = mn
	c.Data["RealCode"] = code
	c.Data["RealNum"] = num
	c.Data["RealData"] = rd
	c.Data["PageNum"] = pagenum
	c.Data["PageAll"] = all
	c.TplName = "real.html"
}
